package com.ruoyi.examine.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.uuid.UUID;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.examine.mapper.TbDormitoryInspectionMapper;
import com.ruoyi.examine.domain.TbDormitoryInspection;
import com.ruoyi.examine.service.ITbDormitoryInspectionService;

/**
 * 宿舍检查Service业务层处理
 *
 * @author ruoyi
 * @date 2023-12-27
 */
@Service
public class TbDormitoryInspectionServiceImpl implements ITbDormitoryInspectionService
{
    @Autowired
    private TbDormitoryInspectionMapper tbDormitoryInspectionMapper;

    /**
     * 查询宿舍检查
     *
     * @param id 宿舍检查主键
     * @return 宿舍检查
     */
    @Override
    public TbDormitoryInspection selectTbDormitoryInspectionById(String id)
    {
        return tbDormitoryInspectionMapper.selectTbDormitoryInspectionById(id);
    }

    /**
     * 查询宿舍检查列表
     *
     * @param tbDormitoryInspection 宿舍检查
     * @return 宿舍检查
     */
    @Override
    public List<TbDormitoryInspection> selectTbDormitoryInspectionList(TbDormitoryInspection tbDormitoryInspection)
    {
        return tbDormitoryInspectionMapper.selectTbDormitoryInspectionList(tbDormitoryInspection);
    }

    /**
     * 新增宿舍检查
     *
     * @param tbDormitoryInspection 宿舍检查
     * @return 结果
     */
    @Override
    public int insertTbDormitoryInspection(TbDormitoryInspection tbDormitoryInspection)
    {
//        tbDormitoryInspection.setCreateTime(DateUtils.getNowDate());
        tbDormitoryInspection.setId(UUID.randomUUID().toString().replaceAll("-", ""));
        return tbDormitoryInspectionMapper.insertTbDormitoryInspection(tbDormitoryInspection);
    }

    /**
     * 修改宿舍检查
     *
     * @param tbDormitoryInspection 宿舍检查
     * @return 结果
     */
    @Override
    public int updateTbDormitoryInspection(TbDormitoryInspection tbDormitoryInspection)
    {
        tbDormitoryInspection.setUpdateTime(DateUtils.getNowDate());
        return tbDormitoryInspectionMapper.updateTbDormitoryInspection(tbDormitoryInspection);
    }

    /**
     * 批量删除宿舍检查
     *
     * @param ids 需要删除的宿舍检查主键
     * @return 结果
     */
    @Override
    public int deleteTbDormitoryInspectionByIds(String[] ids)
    {
        return tbDormitoryInspectionMapper.deleteTbDormitoryInspectionByIds(ids);
    }

    /**
     * 删除宿舍检查信息
     *
     * @param id 宿舍检查主键
     * @return 结果
     */
    @Override
    public int deleteTbDormitoryInspectionById(String id)
    {
        return tbDormitoryInspectionMapper.deleteTbDormitoryInspectionById(id);
    }
}
